#!/usr/bin/env python3

from toNum import toNum, out

def outFloat(f, bit=6, end='\n'):
    if f < 0:
        f *= -1
        out('-')

    toNum(int(f), 10, '')

    out('.')

    f = f - int(f)

    for i in range(bit):
        out(chr(int(f * 10) + 48))
        f = f * 10 - int(f * 10)

    if end:
        out(end)

if __name__ == "__main__":
    outFloat(356.8789, 2)
    outFloat(-356.8789)
    outFloat(0.8789)
